<?php
/**
 * basic admin_controller
 *
 * @version:	0.1a
 * @package:	global
 * @author: 	alex_ez
 * @created:	28.03.2010 16:52
 *
 * @copyright:	(c) 2010 alex <qfox@ya.ru> yaroshevich aka alex_ez. All rights reserved.
 */


abstract class basic_admin_controller extends controller
{
	public function on_load( &$walker )
	{
		$this->visitor = visitor::instance( );
		$this->visitor->need_auth( 'admin', true );

		$this->frame = 'admin/!index.tpl';

		return parent::on_load( $walker );
	}
	
	public function page_index( $p, $o )
	{
		return texo::translate( 'You have reached admin/index page. Please write page_index in your admin controller.' );
	}
	
	public function block_fullmenu( $p )
	{
		if( !isset( $p['_'] ) )
			$p['_'] = array( );
		
		$o = array( );
		$o['extends'] = array( 'refbook_controller', 'reference_controller', 'admin_controller' );
		$o['suffix'] = '_admin_controller';
		$o['listcallback'] = 'get_admin_controllers';
		$o['urlbase'] = '/admin/';
		
		$p['_'] += $o;
		$p['mode'] = _::pick( @$p['mode'], 'drops' );
		
		return parent::block_fullmenu( $p );
	}
}


